<?php

//王晓梦
namespace app\common\model;


use think\model;

class Purchase extends Model
{
    //  连接数据库
    protected $connection = 'mysql';
    //  连接表名
    protected $name = 'purchase';
    //  自动写入时间戳字段
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    //关联分类表
    public function getCate()
    {
        return $this->hasOne(Cate::class, 'id', 'cate_id')->field('id,name');
    }
}